package com.zhengbing.tj.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.AllArgsConstructor;

import java.time.LocalDateTime;

/**
 * 登录记录实体类
 * 记录用户登录登出的详细信息
 *
 * @author zhengbing
 * @date 2025-07-25
 */
@TableName("login_record")
@Api(tags = "登录记录")
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
public class LoginRecord extends Model<LoginRecord> {
    /**
     * 主键ID
     */
    @ApiModelProperty(value = "主键ID", example = "123456789012345678")
    @TableId(type = IdType.ASSIGN_ID)
    private Long id;

    /**
     * 用户ID
     */
    @ApiModelProperty(value = "用户ID", example = "1001")
    private Long userId;

    /**
     * 登录时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "登录时间", example = "2025-07-25 10:30:00")
    private LocalDateTime loginTime;

    /**
     * 登出时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "登出时间", example = "2025-07-25 18:30:00")
    private LocalDateTime logoutTime;

    /**
     * 登录IP地址
     */
    @ApiModelProperty(value = "登录IP地址", example = "192.168.1.1")
    private String ipAddress;

    /**
     * 登录设备信息
     */
    @ApiModelProperty(value = "设备信息", example = "Mozilla/5.0 Windows NT 10.0 Chrome/91.0.4472.124")
    private String deviceInfo;

    /**
     * 登录状态：0-登录中，1-已登出，2-异常退出
     */
    @ApiModelProperty(value = "登录状态：0-登录中，1-已登出，2-异常退出", example = "0")
    private Integer status;

    /**
     * 登录位置
     */
    @ApiModelProperty(value = "登录位置", example = "北京市")
    private String location;
    
    // 显式添加setter和getter方法以确保编译通过
    public void setUserId(Long userId) {
        this.userId = userId;
    }
    
    public Long getUserId() {
        return userId;
    }
    
    public void setLoginTime(LocalDateTime loginTime) {
        this.loginTime = loginTime;
    }
    
    public LocalDateTime getLoginTime() {
        return loginTime;
    }
    
    public void setIpAddress(String ipAddress) {
        this.ipAddress = ipAddress;
    }
    
    public String getIpAddress() {
        return ipAddress;
    }
    
    public void setDeviceInfo(String deviceInfo) {
        this.deviceInfo = deviceInfo;
    }
    
    public String getDeviceInfo() {
        return deviceInfo;
    }
    
    public void setStatus(Integer status) {
        this.status = status;
    }
    
    public Integer getStatus() {
        return status;
    }
    
    public void setLogoutTime(LocalDateTime logoutTime) {
        this.logoutTime = logoutTime;
    }
    
    public LocalDateTime getLogoutTime() {
        return logoutTime;
    }
    
    public void setLocation(String location) {
        this.location = location;
    }
    
    public String getLocation() {
        return location;
    }
    
    public void setId(Long id) {
        this.id = id;
    }
    
    public Long getId() {
        return id;
    }
}